package org.bedracket.pgeg.event;

import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import org.bedracket.pgeg.network.ManaChangeMessage;
import org.bedracket.pgeg.network.OpenTestMenuMessage;
import org.bedracket.pgeg.network.PlayerManaMessage;
import org.bedracket.pgeg.network.SimpleNetworkHandler;

@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
public class SetupEvents {

    @SubscribeEvent
    public static void registerMessage(FMLCommonSetupEvent event) {
        event.enqueueWork(() -> {
            SimpleNetworkHandler.registerMessage(PlayerManaMessage.class,
                    PlayerManaMessage::buffer, PlayerManaMessage::new, PlayerManaMessage::handler);
            SimpleNetworkHandler.registerMessage(ManaChangeMessage.class,
                    ManaChangeMessage::buffer, ManaChangeMessage::new, ManaChangeMessage::handler);
            SimpleNetworkHandler.registerMessage(OpenTestMenuMessage.class,
                    OpenTestMenuMessage::buffer, OpenTestMenuMessage::new, OpenTestMenuMessage::handler);
        });
    }
}
